home *** CD-ROM | disk | FTP | other *** search
/ Freelog 125 / Freelog_MarsAvril2015_No125.iso / Musique / Quod Libet / quodlibet-3.3.0-installer.exe / bin / quodlibet / player / gstbe / prefs.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2014-12-31  |  4KB  |  80 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.7)
  3.  
  4. from gi.repository import Gtk
  5. from quodlibet import config
  6. from quodlibet.qltk.ccb import ConfigCheckButton
  7. from quodlibet.qltk.entry import UndoEntry
  8. from quodlibet.qltk.x import Button
  9. from quodlibet.util import connect_obj
  10.  
  11. class GstPlayerPreferences(Gtk.VBox):
  12.     
  13.     def __init__(self, player, debug = False):
  14.         super(GstPlayerPreferences, self).__init__(spacing = 6)
  15.         e = UndoEntry()
  16.         e.set_tooltip_text(_('The GStreamer output pipeline used for playback. Leave blank for the default pipeline. In case the pipeline contains a sink, it will be used instead of the default one.'))
  17.         e.set_text(config.get('player', 'gst_pipeline'))
  18.         
  19.         def changed(entry):
  20.             config.set('player', 'gst_pipeline', entry.get_text())
  21.  
  22.         e.connect('changed', changed)
  23.         pipe_label = Gtk.Label(label = _('_Output pipeline:'))
  24.         pipe_label.set_use_underline(True)
  25.         pipe_label.set_mnemonic_widget(e)
  26.         apply_button = Gtk.Button(stock = Gtk.STOCK_APPLY)
  27.         
  28.         def format_buffer(scale, value):
  29.             return _('%.1f seconds') % value
  30.  
  31.         
  32.         def scale_changed(scale):
  33.             duration_msec = int(scale.get_value() * 1000)
  34.             player._set_buffer_duration(duration_msec)
  35.  
  36.         duration = config.getfloat('player', 'gst_buffer')
  37.         scale = Gtk.HScale.new(Gtk.Adjustment(value = duration, lower = 0.2, upper = 10))
  38.         scale.set_value_pos(Gtk.PositionType.RIGHT)
  39.         scale.set_show_fill_level(True)
  40.         scale.connect('format-value', format_buffer)
  41.         scale.connect('value-changed', scale_changed)
  42.         buffer_label = Gtk.Label(label = _('_Buffer duration:'))
  43.         buffer_label.set_use_underline(True)
  44.         buffer_label.set_mnemonic_widget(scale)
  45.         
  46.         def rebuild_pipeline(*args):
  47.             player._rebuild_pipeline()
  48.  
  49.         apply_button.connect('clicked', rebuild_pipeline)
  50.         gapless_button = ConfigCheckButton(_('Disable _gapless playback'), 'player', 'gst_disable_gapless', populate = True)
  51.         gapless_button.set_alignment(0, 0.5)
  52.         gapless_button.set_tooltip_text(_('Disabling gapless playback can avoid track changing problems with some GStreamer versions.'))
  53.         widgets = [
  54.             (pipe_label, e, apply_button),
  55.             (buffer_label, scale, None)]
  56.         table = Gtk.Table(n_rows = len(widgets), n_columns = 3)
  57.         table.set_col_spacings(6)
  58.         table.set_row_spacings(6)
  59.         for left, middle, right in enumerate(widgets):
  60.             left.set_alignment(0, 0.5)
  61.             table.attach(left, 0, 1, i, i + 1, xoptions = Gtk.AttachOptions.FILL | Gtk.AttachOptions.SHRINK)
  62.             if right:
  63.                 table.attach(middle, 1, 2, i, i + 1)
  64.                 table.attach(right, 2, 3, i, i + 1, xoptions = Gtk.AttachOptions.FILL | Gtk.AttachOptions.SHRINK)
  65.                 continue
  66.             table.attach(middle, 1, 3, i, i + 1)
  67.         
  68.         table.attach(gapless_button, 0, 3, 2, 3)
  69.         self.pack_start(table, True, True, 0)
  70.         if debug:
  71.             
  72.             def print_bin(player):
  73.                 player._print_pipeline()
  74.  
  75.             b = Button('Print Pipeline', Gtk.STOCK_DIALOG_INFO)
  76.             connect_obj(b, 'clicked', print_bin, player)
  77.             self.pack_start(b, True, True, 0)
  78.  
  79.  
  80.